fill-region-as-paragraph should better respect the fill-column
authorToru TSUNEYOSHI <t_tuneyosi@hotmail.com>
Fri, 30 Nov 2012 07:10:30 +0000 (15:10 +0800)
committerRob Browning <rlb@defaultvalue.org>
Fri, 15 Aug 2014 22:41:44 +0000 (17:41 -0500)
This upstream patch has been added:

  * textmodes/fill.el (fill-region-as-paragraph): Handle overshoot by move-to-column.

Origin: upstream, commit: r111035, 0483a4f3930f62a0b4d05402c71fa734c6258b8a
Bug: http://debbugs.gnu.org/3234
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=539634
Added-by: Rob Browning <rlb@defaultvalue.org>
lisp/ChangeLog
lisp/textmodes/fill.el

index 01b4a02b3ed9b5d5707ad4e1c53749fe2192a95c..8a902616877c7ac98169b1726795f9b502615242 100644 (file)
        * files.el (dir-locals-read-from-file): Check file non-empty
        before reading.  (Bug#13038)
 
+2012-11-30  Toru TSUNEYOSHI  <t_tuneyosi@hotmail.com>
+
+       * textmodes/fill.el (fill-region-as-paragraph): Handle overshoot
+       by move-to-column (Bug#3234).
+
 2012-11-28  Glenn Morris  <rgm@gnu.org>
 
        * jka-cmpr-hook.el (jka-compr-get-compression-info):
index feb2fa6cc73e3c6892542bf4d6b8acd539325977..5b6d5f359e64e1075e91a3f161031ca49e85d977 100644 (file)
@@ -721,7 +721,11 @@ space does not end a sentence, so don't break a line there."
            (move-to-column (current-fill-column))
            (if (when (< (point) to)
                  ;; Find the position where we'll break the line.
-                 (forward-char 1) ;Use an immediately following space, if any.
+                 ;; Use an immediately following space, if any.
+                 ;; However, note that `move-to-column' may overshoot
+                 ;; if there are wide characters (Bug#3234).
+                 (unless (> (current-column) (current-fill-column))
+                   (forward-char 1))
                  (fill-move-to-break-point linebeg)
                  ;; Check again to see if we got to the end of
                  ;; the paragraph.